
$(document).ready(function(){
	var type=getvl("type");
	var userId=getvl("userId");
	var current =1;
	findDataList(type,userId,"",current);
});







function findDataList(type,userId,orderNumber,current){
	$("#thislist").html("");
	   $.ajax({
        url: urlcore + "/api/flowDetail/selectFlowList?type="+type+"&muserId="+userId+"&orderNumber="+orderNumber+"&current="+current,
        type: "get",
        dataType: 'json',
        contentType: "application/json;charset=utf-8",
        success: function (data) {
        	var da=data.data.records;
        	var html="";
        	for(var i=0;i<da.length;i++){
        		
        		if(da[i].uptDatetime!=null){
        			uptDatetime=da[i].uptDatetime;
        		}
        	    html+= " <tr >\n" +
			            " <td>" + (i + 1) + "</td>\n" +
			            " <td>" + da[i].orderNumber + "</td>\n" +
			            " <td>" + da[i].money + "</td>\n" +
			            " </tr>";
        	}
        	$("#thislist").append(html);
            $("#this_title").html(thisTitle(type));
             $("#pager").pager({
                pagenumber: current,
                pagecount: data.data.pages,
                totalcount: data.data.total,
                buttonClickCallback: PageClick
            });
        	
        },
        error: function () {
            /* Act on the event */
            alert("error");
        }
    });
	
}


PageClick = function (pageclickednumber) {
	var type=getvl("type");
	var userId=getvl("userId");
	var orderNumber=$("#orderNumber").val();
	findDataList(type,userId,orderNumber,pageclickednumber);
}

/**
 * 搜索
 */
function searchList(){
	var orderNumber=$("#orderNumber").val();
	var type=getvl("type");
	var userId=getvl("userId");
	findDataList(type,userId,orderNumber,1);
	
}


var thisTitle=function getTitle(type){
	var da="";
	if(type==1){
		da="不可用哆币列表";
	}else if(type==2){
		da="不可用雅币列表";
	}else if(type==3){
		da="返回哆币列表";
	}else if(type==4){
		da="返回雅列表";
	}else{
		da="消费列表";
	}
	return da;
}
